package com.qingyun.customview.hencode.practice1.views

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View

class Practice1DrawPointView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0,
) : View(context, attrs, defStyleAttr) {
    private val paint = Paint()
    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)

        paint.color = Color.BLACK
        paint.strokeWidth = 40f
        paint.style = Paint.Style.STROKE
        paint.strokeCap = Paint.Cap.SQUARE
        canvas.drawPoint(100f, 100f, paint)

        paint.color = Color.BLUE
        paint.strokeWidth = 40f
        paint.style = Paint.Style.FILL
        paint.strokeCap = Paint.Cap.ROUND
        canvas.drawPoint(200f, 100f, paint)

        paint.color = Color.RED
        paint.strokeWidth = 40f
        paint.style = Paint.Style.FILL_AND_STROKE
        paint.strokeCap = Paint.Cap.BUTT
        canvas.drawPoint(300f, 100f, paint)
    }
}